New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kunit

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kunit

KUnit ---

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

KUnit

一个可以用于微信小程序和浏览器的单元测试框架

例子

import { test } from '../index';
import { assert } from 'chai';
import KUnit from '../index';

test('测试用例1', function () {
    assert.equal(1, 1);
})

let case2 = test('异步测试用例 2', function () {
    test('2-1', async function () {
        await (3000);
        assert.equal(1, 1);
        console.log('FINISH 2-1')
    })

    test('2-2', async function () {
        await (500);
        assert.equal(1, 2);
        console.log('FINISH 2-2')
    })
})

test('测试用例3', function () {
    assert.equal(1, 2, '1等于2应该异常');
})

test('同步测试用例 4', function () {
    test('2-1', function () {
        assert.equal(1, 1);
    })

    test('2-2', function () {
        assert.equal(1, 2);
    })
})

async function wait(ms: number) {
    return new Promise(rs => {
        setTimeout(() => { rs() }, ms);
    })
}

KUnit.instance.runAll();

FAQs

Package last updated on 17 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc